Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $data_operation = $this->pdo('select * from operations, users_operations where operations.id = users_operations.id_operation && = ?', [
- $this->id
- ])->fetchAll(PDO::FETCH_OBJ);
- $data_mission = $this->pdo('select * from missions, users_operations where missions.id = users_missions.id_mission && users_missions.id_user = ?', [
- $this->id
- ])->fetchAll(PDO::FETCH_OBJ);
- $this->set(compact('data_operation', 'data_mission'));
- <?php foreach ($data_operation as $key => $operation) : ?>
- <!--вывод операций-->
- <?php
- $mission_array = [];
- foreach ($data_mission as $v) {
- if ($v->id_operation == $operation->id){
- ?>
- <!--вывод миссий операций-->
- <?
- }
- }
- ?>
- <?php endforeach; ?>
- ---------
- <?php
- $data = $this->pdo('select {только то что юзаешь и если дублируется делаешь алиасы} from missions m left join users_operations uo on u.id=uo.id_mission left join operations o on o.id=uo.id_operation where uo.id_user=?', [
- $this->id
- ])->fetchAll(PDO::FETCH_OBJ);
- $lastOpID=0;
- foreach($data as $item){
- if($item->operation_id!=$lastOpId){
- //operations
- $lastOpId=$item->operation_id;
- }else{
- //missions
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement